﻿// Open Source: MIT License (http://www.opensource.org/licenses/mit-license.php)
// Project: YoProgramo.NET (http://code.google.com/p/yoprogramo/)
// Autor: Fabian Figueredo (info@fabianfigueredo.com.ar)
// Blog: blog.yoprogramo.net

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YoProgramo.Domain.Core;
using YoProgramo.Domain.Core.Entities;
using YoProgramo.Domain.Core.Interfaces;

namespace YoProgramo.Infrastructure.Data.Repositories
{
    public class TagRepository : RepositoryBase<ITag, Tag, long>, ITagRepository {
        public TagRepository()
        {
        }

        public TagRepository(IDao<Tag, ITag, long> dao): base(dao) {
        }


        #region ITagRepository Members

        public ITag FindByName(string name) {
            Check.Require(!String.IsNullOrEmpty(name), "Name no puede ser nulo");
            return dao.GetAll().FirstOrDefault(w => w.Name.ToLower() == name.ToLower()) as ITag;
        }

        #endregion
    }
}